<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:constants="http://www.tuanzi.com/constants/tags">

<p:dialog header="新增" widgetVar="adding" modal="true" closable="true"
          resizable="true"
          style="position: absolute;">
    <p:outputPanel id="add-dialog">
        <div class="ui-g ui-fluid card" style="width:1000px;">
            <div class="ui-g-2">
                <p:outputLabel value="平台"/>
            </div>
            <div class="ui-g-4">
                <p:selectOneMenu id="platform" value="#{extraTemplateInfoBean.special.platform}">
                    <p:ajax event="change" listener="#{extraTemplateInfoBean.onSpecialSelectPlatform()}" update="add-dialog" process="@form"/>
                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                  noSelectionOption="true"/>
                    <f:selectItem itemLabel="android" itemValue="android"/>
                    <f:selectItem itemLabel="ios" itemValue="ios"/>
                </p:selectOneMenu>
            </div>

            <div class="ui-g-2">
                <p:outputLabel value="作用渠道"/>
            </div>
            <div class="ui-g-4">
                <p:selectCheckboxMenu id="channel" value="#{extraTemplateInfoBean.channelIdList}"
                                      updateLabel="true" multiple="true" filter="true"
                                      filterMatchMode="contains">
                    <f:selectItems
                            value="#{extraTemplateInfoBean.commProductChannels}"
                            var="channel"
                            itemLabel="#{channel.channelName}(#{channel.channelCode})"
                            itemValue="#{channel.channelCode}"/>
                </p:selectCheckboxMenu>
            </div>

            <div class="ui-g-12 card" style="background-color: #eff1f3;border-radius: 10px;">
                <h3><b>Banner区</b></h3>
                <div class="ui-g-2">
                    <p:outputLabel value="网页标题"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText id="title" value="#{extraTemplateInfoBean.special.title}"
                                 />
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="主题颜色"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="theme" value="#{extraTemplateInfoBean.special.theme}">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems
                                value="#{extraTemplateInfoBean.dictionaries[DictionaryCode.EXTRA_TEMPLATE_THEME]}"
                                var="dic"
                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="banner"/>
                </div>
                <div class="ui-g-1">
                    <p:graphicImage id="specialBanner" url="#{extraTemplateInfoBean.special.banner}" width="80"/>
                </div>
                <div class="ui-g-2">
                    <p:fileUpload fileUploadListener="#{extraTemplateInfoBean.onUploadSpecialBanner}"
                                  mode="advanced"
                                  fileLimit="1"
                                  auto="true"
                                  fileLimitMessage="只能上传一个文件"
                                  invalidFileMessage="不支持上传文件类型"
                                  invalidSizeMessage="文件过大"
                                  sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                  allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                                  label="上传" update="add-dialog" process="@form"
                                  />
                </div>
                <div class="ui-g-1">
                    <p:commandButton value="删除"
                                     actionListener="#{extraTemplateInfoBean.deleteImg('specialBanner')}"
                                     update="specialBanner" process="@this"
                                     disabled="#{extraTemplateInfoBean.isView()}"/>
                </div>
            </div>
            <div class="ui-g-12 card" style="background-color: #eff1f3;border-radius: 10px;">
                <h3><b>登记区</b></h3>
                <div class="ui-g-2">
                    <p:outputLabel value="登记类型"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="registerType" value="#{extraTemplateInfoBean.special.registerType}">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems
                                value="#{extraTemplateInfoBean.dictionaries[DictionaryCode.EXTRA_TEMPLATE_REGISTER_TYPE]}"
                                var="dic"
                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="登记框下信息（单选）"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="question" value="#{extraTemplateInfoBean.special.question}">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems
                                value="#{extraTemplateInfoBean.dictionaries[DictionaryCode.EXTRA_TEMPLATE_QUESTION]}"
                                var="dic"
                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="按钮文案"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText id="btnText" value="#{extraTemplateInfoBean.special.btnText}"
                                 />
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="按钮下方文案"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText id="btnBottomText" value="#{extraTemplateInfoBean.special.btnBottomText}"
                                 />
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="登记区背景" />
                </div>
                <div class="ui-g-1">
                    <p:graphicImage id="specialRegisterImg" url="#{extraTemplateInfoBean.special.registerImg}" width="80" />
                </div>
                <div class="ui-g-2">
                    <p:fileUpload fileUploadListener="#{extraTemplateInfoBean.onUploadSpecialRegisterImg}"
                                  mode="advanced"
                                  fileLimit="1"
                                  auto="true"
                                  fileLimitMessage="只能上传一个文件"
                                  invalidFileMessage="不支持上传文件类型"
                                  invalidSizeMessage="文件过大"
                                  sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                  allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                                  label="上传" update="add-dialog" process="@form"
                                  disabled="#{extraTemplateInfoBean.isView()}" />
                </div>
                <div class="ui-g-1">
                    <p:commandButton value="删除"
                                     actionListener="#{extraTemplateInfoBean.deleteImg('specialRegisterImg')}"
                                     update="specialRegisterImg" process="@this"
                                     disabled="#{extraTemplateInfoBean.isView()}"/>
                </div>
            </div>
            <div class="ui-g-12 card" style="background-color: #eff1f3;border-radius: 10px;">
                <h3><b>备注区</b></h3>
                <div class="ui-g-2">
                    <p:outputLabel value="备注图"/>
                </div>
                <div class="ui-g-1">
                    <p:graphicImage id="specialRemarkImg" url="#{extraTemplateInfoBean.special.remarkImg}" width="80"/>
                </div>
                <div class="ui-g-2">
                    <p:fileUpload fileUploadListener="#{extraTemplateInfoBean.onUploadSpecialRemarkImg}"
                                  mode="advanced"
                                  fileLimit="1"
                                  auto="true"
                                  fileLimitMessage="只能上传一个文件"
                                  invalidFileMessage="不支持上传文件类型"
                                  invalidSizeMessage="文件过大"
                                  sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                  allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                                  label="上传" update="add-dialog" process="@form"
                                  />
                </div>
                <div class="ui-g-1">
                    <p:commandButton value="删除"
                                     actionListener="#{extraTemplateInfoBean.deleteImg('specialRemarkImg')}"
                                     update="specialRemarkImg" process="@this"
                                     disabled="#{extraTemplateInfoBean.isView()}"/>
                </div>
                <div class="ui-g-12 padding0">
                    <div class="ui-g-2">
                        <p:outputLabel value="备注区文案"/>
                    </div>
                    <div class="ui-g-10">
                        <p:inputText id="remarkText" value="#{extraTemplateInfoBean.special.remarkText}"/>
                    </div>
                </div>

            </div>
            <div class="ui-g-12">
                <p:commandButton value="确定" style="float: right"
                                 actionListener="#{extraTemplateInfoBean.onSaveSpecial()}"
                                 process="@form"/>
            </div>
        </div>
    </p:outputPanel>
</p:dialog>

</html>
